package org.wicket.jbpm;

import javax.servlet.http.HttpServletRequest;

import org.apache.wicket.Application;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadWebRequest;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebRequest;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.wicket.jbpm.login.WicketJBPMLogin;

/**
 * Application object for your web application. If you want to run this application without deploying, run the Start class.
 * 
 * @see StartJbpm.myproject.Start#main(String[])
 */
public class WicketJBPMApplication extends WebApplication
{    
    /**
     * Constructor
     */
	public WicketJBPMApplication()
	{
	}
	
	@Override
	protected void init() {
		super.init();
		addComponentInstantiationListener(new SpringComponentInjector(this));
		
	}

	/**
	 * @see wicket.Application#getHomePage()
	 */
	public Class getHomePage()
	{
		return WicketJBPMLogin.class;
	}

	public static WicketJBPMApplication get()
	{
		return (WicketJBPMApplication) Application.get();
	}
	
	
	
	@Override
	public Session newSession(Request request, Response response)
	{
	    return new WicketJBPMSession(request);
	}

	protected WebRequest newWebRequest(HttpServletRequest servletRequest) {
		return new UploadWebRequest(servletRequest);
	}
}
